import React, { Component } from 'react'
import { WelcomeComponent } from '../../components'

export default class AjaxTest extends Component {
    //Ajax 调用示例1
    AjaxHandle = (rowObj) => {
        this.setState({resData: null});
        //根据对象的Id 属性获取对象信息
        let userId = rowObj.userId;
        const options= {
            url: '/base/auth/user/r/'+userId,
            condition:{},
        };
        fetchData(this, options, this.editGetInfoCallBack);  //注意这里不要有 小括号
    }
    editGetInfoCallBack = (resData) =>{
        this.setState({
            submitUrl:'/base/auth/user/u',
            resData: resData
        });
        this.showModal();//显示弹框
    }


    //Ajax 调用示例2
    AjaxHandle2 = (rowObj) => {
        //根据对象的Id 属性获取对象信息
        const options= {
            url: '/base/resrole/r',
            type: 'get',
            condition:{
                id: rowObj.resroleId
            }
        };
        fetchData(this, options, (resData) => {
            this.setState({
                resData: resData
            });

            this.showModal();//显示弹框
        });
    }



    render() {
        return(
            <WelcomeComponent />
        )
    }
}
